<template>
	<view>
		<view class="dis_f aic jub mian" v-for="(item,index) in list" :key="index" @click="jump(item)">
			<view class="dis_f aic">
				<view class="dian">

				</view>
				<view class="ml10 fs28">
					{{item.title}}
				</view>
			</view>
			<text class="iconfont icon-jiantou"></text>
		</view>
		<view class="dis_f juc cac fs26" style="padding: 30rpx;" v-if="list.length == 0">
			暂无数据
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
				pageConten: 0,
				loadstatus: '上拉加载更多',
			}
		},
		onLoad(option) {
		},
		onShow() {
			this.list = []
			this.page = 1
			this.postlist()
		},
		onReachBottom() {
			if (this.page < this.pageConten) {
				this.page++
				this.postlist()
			} else if (this.page == this.pageConten) {
				this.loadstatus = '没有更多了'
			}
		},
		// 下拉刷新
		onPullDownRefresh() {
			this.list = []
			this.page = 1
			this.postlist()
			uni.stopPullDownRefresh(); //停止刷新
			// this.xialashow = true
		},
		methods: {
			jump(item) {
				uni.navigateTo({
					url: '/pagesA/in_text/in_text?type='+1+'&id='+item.id
				})

			},
			postlist() {

				this.api.post('index/newslst', {
					page: this.page,
					size: 10,
					type:1
				}).then(res => {
					console.log(res);
					if (res.code == 200) {

						this.pageConten = res.ext.pageCount
						this.list = this.list.concat(res.data);
						this.page >= this.pageConten ? this.loadstatus = '没有更多了' : this.loadstatus = '上拉加载更多'


					}


				})
			},
		}
	}
</script>

<style>
	.mian {
		padding: 25rpx;
		border-bottom: 1px solid #efefef;
	}

	.dian {
		width: 10rpx;
		height: 10rpx;
		background: #E9121D;
		border-radius: 50rpx;
	}
</style>